<? /* license

BilugCMS (http://www.bilug.it) - Content Management System for dynamic web sites
Copyright (C) 2005-2008  Federico Villa and Alessio Loro Piana

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

For reference, contact bilugcms@vilnet.it


license */ ?>

<?
//ricevo l'id del prodotto
$id = $_GET["id"];
$op = $_GET["op"];
$quant = $_GET["quant"];

//query per estrarre tutti i dettagli del prodotto
$query = "SELECT id, titolo, descrizione, prezzo, quantita, foto, fotofacoltative, codice, produttore, spedizione, prezzo_intero, colore, taglia FROM ecommerce WHERE id = '$id'";
$ris = mysql_query($query);
$prod = mysql_fetch_row($ris);

if($op=="")
{
	$quant=1;
}
if($op=="su")
{
	if(!($prod[4]==$quant))
	 {
		 
		 $quant=$quant+1;
	}
}
if($op=="giu")
{
	if($quant>1)
	{
		 $quant--;
	}
}

?>
<h1> <?echo "$prod[1]";?> </h1>
<br>
<div class="contenitore">	
<div class="float300">
<? 
	if($prod[5]=="")
		echo "<a href=\"./img/images/$prod[5]\"><img src=\"./img/images/standard.jpg\" id=\"ecomprinc\"></a>";
	else
		{
		$fototrunk = strrpos($prod[5],"/");
		$fototrunk = $fototrunk + 1;
		$prod[5] = substr($prod[5], $fototrunk);
		$prod[5] = substr($prod[5], 0, strlen($prod[5])-1);
		echo "<a href=\"./img/images/$prod[5]\"><img src=\"./img/images/$prod[5]\" id=\"ecomprinc\"></a>";
		}
?>
</div>
	
<div class="float300">
<h3>Codice: </h3>
<center>
 <?echo "$prod[7]";?>
</center>
<br>
<h3>Produttore: </h3>
<center>
 <?echo "$prod[8]";?>
</center>
<br>

<div class="float140">
<h2> Prezzo:</h2> <center><br>
<?php
	$prezzoprod = number_format( $prod[3], 2, ',', '.' );

	if ( $prod[10] > $prod[3] )
		echo "<span style=\"text-decoration:line-through; color:red;\">".number_format( $prod[10], 2, ',', '.' )." &euro;</span><br />";

	echo "<span>$prezzoprod &euro;</span>";
?>

</center>
</div>

<div class="float160">
 <h2>Costo aggiuntivo Spedizione :</h2><center><br>
 <?$prezzoagg=number_format($prod[9], 2, ',', '.');
 echo "$prezzoagg";?> &euro;</center>
</div>
<div class="azzerafloat"><br><br></div>
<div class="float140">
 <h2>Disponibilita':</h2><center><br>
<?
if ($prod[4]>0)
{
	echo "$prod[4]";
	}
else
{
	echo "Articolo Esaurito";
	}
?> 
</center>
</div>
<div class="float140">
<h2>Quantita':</h2><br><center>
<?
	if ($prod[4]>0)
	{
	echo"<a href=\"index.php?pag=ecommerce_dettaglio.php&id=$id&op=giu&quant=$quant\"> - </a> &nbsp;&nbsp; $quant &nbsp;&nbsp; <a  href=\"index.php?pag=ecommerce_dettaglio.php&id=$id&op=su&quant=$quant\"> + </a>";
		}
	else
	{
	echo"0";
		}
?></center>
</div>
<div class="azzerafloat"><br></div>
<div class="float140">&nbsp;</div>
<div class="float160">
<?
	if ($prod[4]>0)
	{
		echo "<br><br>Aggiungi al Carrello:<a href=\"index.php?pag=ecommerce_dettaglio.php&id=$id&aggiungi=$id&carrello1=si&quant=$quant\" id=\"ecomico\"> <img src=\"../img/carrello_freccia.png\" id=\"ecomico\"> </a>";
	}
?>
</div>
</div>
<div class="azzerafloat"><br></div>
<div class="float140">&nbsp;</div>
<br>
<h3>Descrizione:</h3>
 <?php
 if ( @$prod[11] )
	echo "<strong>COLORE</strong>: $prod[11]<br />";
 if ( @$prod[12] )
	echo "<strong>TAGLIA</strong>: $prod[12]<br /><br />";
 echo "$prod[2]";
 ?>
<br>
<div class="float610">
<div class="contenitore">	
<?
$foto=explode(';', $prod[6]);
$i=0;
while($foto[$i])
{
 $fototrunk = strrpos($foto[$i],"/");
 $fototrunk = $fototrunk + 1;
 $foto[$i] = substr($foto[$i], $fototrunk);
 echo "<a href=\"./img/images/$foto[$i]\"><img src=\"./img/images/$foto[$i]\" id=\"ecomsec\"></a>";
 echo"&nbsp;&nbsp;&nbsp;";
 $i++;
}

?>
</div>
</div>
</div>

